import { createRouter, createWebHashHistory } from "vue-router";

import three from "./routeThree";
import cesium from "./routeCesium";
import webgl from "./routeWebgl";
import webgpu from "./routeWebgpu";
import test from "./routeTest";

import Home from "../views/Home.vue";
import MenuThree from "../views/MenuThree.vue";
import MenuCesium from "../views/MenuCesium.vue";
import MenuWebgl from "../views/MenuWebgl.vue";
import MenuWebgpu from "../views/MenuWebgpu.vue";
import MenuTest from "../views/MenuTest.vue";
import Makeapie from "../views/Makeapie.vue";

const routes = [
  {
    path: "/",
    name: "home",
    component: Home,
    meta: {
      index: 0,
    },
  },
  {
    path: "/three",
    name: "three",
    component: MenuThree,
    meta: {
      index: 1,
    },
    children: three,
    redirect: three[0].path,
  },
  {
    path: "/cesium",
    name: "cesium",
    component: MenuCesium,
    meta: {
      index: 2,
    },
    children: cesium,
    redirect: cesium[0].path,
  },
  {
    path: "/webgl",
    name: "webgl",
    component: MenuWebgl,
    meta: {
      index: 3,
    },
    children: webgl,
    redirect: webgl[0].path,
  },
  {
    path: "/webgpu",
    name: "webgpu",
    component: MenuWebgpu,
    meta: {
      index: 4,
    },
    children: webgpu,
    redirect: webgpu[0].path,
  },
  {
    path: "/test",
    name: "test",
    component: MenuTest,
    meta: {
      index: 4,
    },
    children: test,
    redirect: test[0].path,
  },
  {
    path: "/makeapie",
    name: "makeapie",
    component: Makeapie,
    meta: {
      index: 5,
    },
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

export default router;
